const Socket = require('./socket')
const Player = require('./player')
const Room = require('./room')
const Game = require('./game');
const Util = require('./util');

class Core {
  static init(option) {
    global.option = option;

    this.load();
  }

  static load(){
    // socket连接方法
    Core.socket = new Socket();
    
    // 保存所有的玩家
    Core.player = new Player();

    // 保存所有的房间
    Core.room = new Room();

    // 所有的游戏实例
    Core.game = new Game();

    // 加载util
    Core.util = Util;

    global.Core = Core;
  }
}

module.exports = Core;